Skip to content

Refine AWS IAM policy creation detections - #4446

Draft
themaryjo wants to merge 5 commits into
developfrom
AWS-IAM-detections-batch-1
Draft

themaryjo wants to merge 5 commits into
developfrom
AWS-IAM-detections-batch-1

Conversation

@themaryjo

Copy link
Copy Markdown
Contributor

Summary

Refines two AWS IAM policy detections to require an Allow statement specifying all actions and all resources within the same statement. Updates descriptions and findings to avoid asserting that policy creation gave the caller permissions.

Detection Scope Changes
AWS Create Policy Version to allow all resources Successful CloudTrail CreatePolicyVersion events Requires Effect="Allow" and exact "*" Action/Resource values within one statement; adds scalar/array handling; retains targeted spath; removes statement-count aggregation; retains actor, policy/version identifiers, default-version flags, event ID, and matching statement.
ASL AWS Create Policy Version to allow all resources Successful ASL IAM CreatePolicy events Adds IAM service and success filters; replaces broad extraction and substring regex matching with targeted, same-statement permission checks; adds scalar/array handling; removes aggregation; retains policy and event context; deduplicates populated event IDs to return one representative matching statement per event within a search run.

In both rules we updated descriptions, logic, findings, false-positive, versions, and modification dates.

Scope clarification

The ASL rule retains its existing CreatePolicy operation and unchanged title. Its description now clarifies the actual scope. The title/operation mismatch remains a documented limitation.

A matching event does not establish that a policy was attached or that the caller gained its permissions. Non-default versions and conditional wildcard statements remain in scope.

Extraction and performance

Targeted spath was selected:

  • For the standard CloudTrail rule, it was faster in the local comparison.
  • For ASL, targeted spath and JSON functions had effectively equivalent single-event runtimes. These observations do not establish production-scale performance improvements, since the tests were done with uploaded datasets.

Validation

  • Manual Splunk fixture tests confirmed positive matching and investigation-field extraction.
  • The ASL automated detection test passed.
  • Complete regression coverage, ASL array handling, and production-scale performance remain validation limitations.

Related dataset change

Dataset draft PR: splunk/attack_data#1277

The CloudTrail fixture is replaced with one anonymized real-lab event creating a non-default wildcard Allow policy version. Its filename is preserved. The ASL fixture remains unchanged.

The existing public dataset URL continues to serve the old CloudTrail fixture until the dataset PR is merged.

@patel-bhavin

patel-bhavin commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Is there a bug/issue we are trying to fix in here? the current detection does accurate catch the new simulations as well so I was curious what got reported for the current detection.

image

version_id='responseElements.policyVersion.versionId',
set_as_default='requestParameters.setAsDefault',
returned_is_default='responseElements.policyVersion.isDefaultVersion',
event_id=eventID,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a | stats count min(_time) as firstTime max(_time) as lastTime............ field in here so that the output is in a table format?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with the asl detection.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes applied

About this:
Is there a bug/issue we are trying to fix in here? the current detection does accurate catch the new simulations as well so I was curious what got reported for the current detection.

Yes, the current rule catches the new positive simulation too. The change is mainly about avoiding matches outside the intended scope. This change makes matching more precise: it requires Allow, all actions, and all resources in the same statement, avoiding matches on Deny or restricted permissions. We found this during our review, not from a reported customer issue.

Adding event-key grouping, stats, timestamp creation, and removal of the internal grouping field.
matching_row_count counts matching rows after statement expansion, including duplicate ingestion—not distinct API calls. The permission logic remains unchanged.
Updated the search to use event-level stats, replacing dedup and retaining all distinct matching statements and first/last timestamps. Corrected the risk drilldown’s data-model syntax.
values(set_as_default) AS set_as_default
values(returned_is_default) AS returned_is_default
values(matching_statement) AS matching_statement
BY event_key

@patel-bhavin patel-bhavin Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing this whole stats BY event_id, its recommended to include the following in the stats that way, for each user, aws_account_id - it is a new row in the result and more like how we have written other AWS detections. No need for creating a new field event_key

signature dest user
           user_agent src vendor_account
           vendor_region vendor_product

Updated aggregation to use the requested actor/account/source grouping, while retaining event IDs, policy details, and matching statements. Added a distinct event count alongside the matching-row count so duplicate ingestion does not appear as multiple unique events.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants